#!/bin/sh

if [ -n "$1" ]; then
    data_date=$1
else
  data_date=$(date -d "-1 days" +%F)
fi


sqoop import \
--connect jdbc:mysql://node101:3306/jtp_app_shujuku \
--username root \
--password 123456 \
--as-textfile \
--query 'select id, areaname, parentid, shortname, level, flag, wgs84_lng, wgs84_lat, gcj02_lng, gcj02_lat, bd09_lng, bd09_lat
             from t_md_areas where 1=1 and $CONDITIONS' \
--delete-target-dir \
--num-mappers 1 \
--target-dir /warehouse/app_basic/t_md_areas/${data_date} \
--fields-terminated-by '\001' \
--null-non-string '\\N' \
--null-string '\\N'